home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / msc4add / insert.txt < prev    next >
Text File  |  1987-01-24  |  15KB  |  331 lines

  1.                     Microsoft C file routines by function
  2.                                                        see p. 88-c for explanation of---> err       inc
  3.                Directory Control   - uses <direct.h>
  4.                
  5.                char *getcwd (char *pathbuf, int buflen)                                   NULL*
  6.                int   chdir (char *pathname)                                               -1*
  7.                int   mkdir (char *pathname)                                               -1*
  8.                int   rmdir (char *pathname)                                               -1*
  9.                
  10.                
  11.                File Handling  - uses 1=<io.h>, 2=<stdio.h>, 3=<fcntl.h>,
  12.                               4=<sys\types.h> & <sys\stat.h>, 5=<sys\locking.h>
  13.                
  14.                int   umask (int pmode)                                                              1,4
  15.                int   rename (char *oldname, char *newname)                                ~0*       1 or 2
  16.                int   remove/unlink (char *pathname)                                       -1*       1 or 2
  17.                char *mktemp (char *template)                                              NULL      1
  18.                int   access (char *pathname, int access-mode)                             -1*       1
  19.                int   chmod (char *pathname, int pmode)                                    -1*       1,4
  20.                int   stat (char *pathname, struct stat *buffer)                           -1*       4
  21.                
  22.                int   fstat (int handle, struct stat *buffer)                              -1*       4
  23.                int   isatty (int handle)                                                            1
  24.                int   setmode (int handle, int translation-mode)                           -1*       1,3
  25.                int   locking (int handle, int lock-mode, long nbyte)                      -1*       1,5
  26.                long  filelength (int handle)                                              -1L*      1
  27.                int   chsize (int handle, long size)                                       -1*       1
  28.                
  29.                
  30.                Low Level I/O  - uses <io.h>, & maybe <stdio.h> for "EOF", etc.
  31.                          also: 1=<fcntl.h>, 2=<share.h>, 3=<sys\types.h> & <sys\stat.h>
  32.                
  33.                int   open (char *pathname, int oflag[, int pmode])                        -1*       1[,3]
  34.                int   sopen (char *pathname, int oflag, int shflag[, int pmode])           -1*       1,2[,3]
  35.                int   creat (char *pathname, int pmode)                                    -1*       1,3
  36.                
  37.                int   dup (int handle)                                                     -1*
  38.                int   dup2 (int handle, int dup-handle)                                    -1*
  39.                int   close (int handle)                                                   -1*
  40.                
  41.                long  lseek (int handle, long offset, int origin)                          -1L*
  42.                long  tell (int handle)                                                    -1L*
  43.                int   eof (int handle)                                                     -1*
  44.                
  45.                int   read (int handle, char *buffer, unsigned int count)                  0/-1*
  46.                int   write (int handle, char *buffer, unsigned int count)                 -1*
  47.                
  48.                                              88-a
  49.                _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                Stream I/O     - uses <stdio.h>
  68.                          also: 1=<varargs.h>  (for UNIX), -or- <stdarg.h>  (for ANSI C)
  69.                
  70.                FILE *fopen (char *pathname, char *type)                                   NULL
  71.                FILE *freopen (char *pathname, char *type, FILE stream)                    NULL
  72.                FILE *tmpfile (void)                                                       NULL
  73.                
  74.                FILE *fdopen (int handle, char *type)                                      NULL
  75.                
  76.                int   fclose (FILE *stream)                                                EOF
  77.                int   fcloseall (void)                                                     EOF
  78.                
  79.                void  setbuf (FILE *stream, char *buffer)
  80.                int   setvbuf (FILE *stream, char *buffer, int buftype, int buflen)        ~0
  81.                
  82.                void  rewind (FILE *stream)
  83.                int   fseek (FILE *stream, long offset, int origin)                        ~0 or ?
  84.                long  ftell (FILE *stream)                                                 -1L
  85.                
  86.                int   fileno (FILE *stream)                                                n/a or ?
  87.                
  88.                int   feof (FILE *stream)
  89.                int   ferror (FILE *stream)
  90.                void  clearerr (FILE *stream)
  91.                
  92.                char *tempnam (char *dir, char *prefix)                                    NULL
  93.                char *tmpnam (char *string)                                                NULL
  94.                int   rmtmp (void)
  95.                
  96.                int   fflush (FILE *stream)                                                EOF
  97.                int   flushall (void)
  98.                
  99.                int   fread (char *buffer, int it-size, int it-count, FILE *stream)        < it-count
  100.                int   getc/fgetc (FILE *stream)                                            ?EOF
  101.                int   getw (FILE *stream)                                                  ?EOF
  102.                char *fgets (char *buffer, int bufsize, FILE *stream)                      ?NULL
  103.                int   fscanf (FILE *stream, char *format[, args...])                       EOF!
  104.                
  105.                int   ungetc (int c, FILE *stream)                                         EOF
  106.                
  107.                int   fwrite (char *buffer, int it-size, int it-count, FILE *stream)       < it-count
  108.                int   putc/fputc (int c, FILE *stream)                                     ?EOF
  109.                int   putw (int binint, FILE *stream)                                      ?EOF
  110.                int   fputs (char *string, FILE *stream)                                   EOF
  111.                int   fprintf (FILE *stream, char *format[, args...])
  112.                int   vfprintf (FILE *stream, char *format, va_list arg-ptr)                         1
  113.                
  114.                                              88-b
  115.                _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.                  (stdin/stdout stream-routines)
  134.                
  135.                int   getchar/fgetchar (void)                                              ?EOF
  136.                char *gets (char *buffer)                                                  ?NULL
  137.                int   scanf (char *format[, args...])                                      EOF!
  138.                
  139.                int   putchar/fputchar (int c)                                             ?EOF
  140.                int   puts (char *string)                                                  EOF
  141.                int   printf (char *format[, args...])
  142.                int   vprintf (char *format, va_list arg-ptr)                                        1
  143.                
  144.                   (buffer i/o stream-routines)
  145.                
  146.                int   sscanf (char *buffer, char *format[, args...])                       EOF!
  147.                int   sprintf (char *buffer, char *format[, args...])
  148.                int   vsprintf (char *buffer, char *format, va_list arg-ptr)                         1
  149.                
  150.                
  151.                Console and port I/O     - uses <conio.h> & <stdio.h> for "EOF", etc.
  152.                
  153.                int   getch (void)
  154.                int   getche (void)
  155.                char *cgets (char *str)
  156.                int   cscanf (char *format[, args...])                                     EOF!
  157.                
  158.                int   ungetch (int c)                                                      EOF
  159.                
  160.                void  putch (int c)
  161.                void  cputs (char *str)
  162.                int   cprintf (char *format[, args...])
  163.                
  164.                int   kbhit (void)
  165.                int   inp (unsigned port)
  166.                int   outp (unsigned port, int value)
  167.                
  168.                -----------------
  169.                
  170.                err = error indication (if any);  '*' signifies that errno is set;  ~0 means non-zero;
  171.                  lone '?' means that return value may be undefined;  ?XXX means that XXX may (or not)
  172.                  indicate an error -check further with eof, feof, ferror;  EOF! means that EOF is always
  173.                  end-of-file;  EOF is defined as -1 in stdio.h (along with NULL, etc.)
  174.                     note: to use errno, must define errno, & maybe sys_nerr, sys_errlist[].  
  175.                
  176.                inc = #include-file requirements - see key at top of each section.
  177.                
  178.                
  179.                
  180.                                              88-c
  181.                _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                Microsoft C string & buffer manipulation routines
  200.                
  201.                     <string.h> declares all functions; <memory.h> declares only buffer functions.
  202.                
  203.                
  204.                Copy      - returns pointer to destination (except memccpy)
  205.                
  206.                char *strcpy (dst,src)        copies src to dst, including \0
  207.                char *strncpy (dst,src,n)     copies exactly n chars, \0-padding if n > len(src)
  208.                
  209.                char *memcpy (dst,src,n)      copies n bytes from src to dst (overlap handled ok)
  210.                char *memccpy (dst,src,c,n)   same, except stops after 1st c (if any)
  211.                     note: memccpy returns pointer to next char in dst following c (or NULL)
  212.                
  213.                void  movedata (src-seg,src-off,dst-seg,dst-off,n)     copies far-data
  214.                     note: movedata useful in small and medium models, (memcpy ok for large)
  215.                
  216.                char *strdup (str)            allocates (malloc) & copies to new storage (NULL = error)
  217.                
  218.                
  219.                Compare   - returns <0, 0, >0 depending on lexicographic order
  220.                          - case-insensitive routines treat all alpha as lower case
  221.                
  222.                int   strcmp (str1,str2)           compare str1 : str2
  223.                int   stricmp/strcmpi (str1,str2)  same, case-insensitive
  224.                int   strncmp (str1,str2,n)        compares 1st n chars
  225.                int  *strnicmp (str1,str2,n)       same, case-insensitive
  226.                
  227.                int   memcmp (buf1,buf2,n)         compares n bytes buf1 : buf2
  228.                int   memicmp (buf1,buf2,n)        same, case-insensitive
  229.                
  230.                
  231.                
  232.                
  233.                
  234.                
  235.                
  236.                
  237.                
  238.                
  239.                
  240.                
  241.                
  242.                
  243.                
  244.                
  245.                
  246.                                              88-d
  247.                _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.               String & buffer routines (continued)
  266.                
  267.                Examine
  268.                
  269.                char *strstr (str,key)        points to 1st key-string in str (or NULL)
  270.                
  271.                char *strchr (str,c)          points to 1st c in str (or NULL) - allows \0
  272.                char *strrchr (str,c)         points to last c (or NULL)
  273.                
  274.                char *memchr (buf,c,n)        points to 1st c in 1st n bytes of buf (or NULL)
  275.                
  276.                char *strpbrk (str,set)       points to 1st char in str from set (or NULL) - no \0
  277.                
  278.                int   strlen (str)            length, not including \0 (i.e., index of the \0)
  279.                
  280.                unsigned strspn (str,set)     index of 1st char NOT in set (=len of str prefix from set)
  281.                unsigned strcspn (str,set)    index of 1st char in set (=len of str prefix NOT from set)
  282.                
  283.                
  284.                
  285.                Modify    - returns pointer to given string/buffer or destination string/buffer
  286.                
  287.                char *strlwr (str)            converts any upper case to lower
  288.                char *strupr (str)            converts any lower case to upper
  289.                
  290.                char *strrev (str)            reverses the string leaving \0 untouched
  291.                
  292.                char *strset (str,c)          sets all except \0 to c
  293.                char *strnset (str,c,n)       sets at most n chars to c, not passing \0
  294.                
  295.                char *memset (buf,c,n)        sets 1st n bytes of buf to c
  296.                
  297.                char *strcat (dst,src)        appends src to dst
  298.                char *strncat (dst,src,n)     appends at most n chars of src to dst
  299.                char *strerror (str)          concatenates last error, \n to str (allows str=NULL)
  300.                     note: strerror requires definition of errno, sys_nerr, sys_errlist[].
  301.                
  302.                
  303.                Examine & Mmodify
  304.                
  305.                char *strtok (str,set)        points to 1st token in str (or NULL)
  306.                         "   (NULL,set)       points to next token in previous str (or NULL)
  307.                     note: set (the delimiters) need not be same on all calls
  308.                     also: strtok skips leading delims, replaces delims with \0
  309.                
  310.                
  311.                
  312.                                              88-e
  313.                _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _+
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.